package com.ecar.api.service.common.impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ecar.api.service.common.PriceRuleService;
import com.ecar.core.common.dao.PriceRuleMapper;
import com.ecar.core.common.entity.PriceRule;

@Service
@Transactional
public class PriceRuleServiceImpl implements PriceRuleService {
	@Autowired
	PriceRuleMapper priceRuleMapper;

	@Override
	public List<Object> selectAll() {
		List<Object> list1 = new ArrayList<>();
		List<PriceRule> list = priceRuleMapper.selectAll();
		for (PriceRule priceRule : list) {
			Map<String, Object> map = new HashMap<String, Object>();
			Integer carLevel = priceRule.getCarLevel();
			String id = priceRule.getId();
			map.put("carLevel", carLevel);
			map.put("id", id);
			list1.add(map);
		}
		return list1;
	}

}
